package sctu.edu.java.year2016.team01.zhuming.day20160523.chapter5_2;

/**   编写Java程序，创建一维数组arr[],将数组中最大的数输出。
 * Created by Administrator on 2016/5/24.
 */
import java.util.Scanner;
public class ZuiDaShu {
    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);
        int arr[] = new int[6];
        System.out.println("请输入6个整数:");
        for (int i = 0; i < arr.length; i++) {
            arr[i] = scan.nextInt();
        }
        int  max=arr[0];
        for (int i = 1; i < arr.length; i++) {

            max=(max>arr[i])?   max:arr[i];

        }
        System.out.println("该数组元素中最大的数是："+ max);
    }
}